import React from 'react'
import { Select } from 'antd'
import _ from 'lodash'

const { Option } = Select

const CommonSelect = ({ value, onChange = null, options = [] }) => {
  const handlerOnChange = (value) => {
    onChange && onChange(value)
  }
  return (
    <>
      <Select style={{ width: 200 }} value={value} onChange={handlerOnChange}>
        {_.map(options, (item, key) => {
          return (
            <Option key={key} value={item.value}>
              {item.label}
            </Option>
          )
        })}
      </Select>
    </>
  )
}

export default CommonSelect
